package com.jiangtai.smartbox.dialog

import android.content.Context
import android.view.View
import com.flyco.dialog.widget.base.BaseDialog
import com.jiangtai.smartbox.R
import kotlinx.android.synthetic.main.dialog_select_way.*

/**
 * Created by heCunCun on 2021/3/26
 */
class LoginDialog(context: Context):BaseDialog<LoginDialog>(context) {
    override fun onCreateView(): View {
        return View.inflate(context, R.layout.dialog_select_way,null)
    }

    override fun setUiBeforShow() {
        widthScale(0.8f)

        tv_open.setOnClickListener {
            if (et_password.text.toString().trim() == "adminpassword" && et_user.text.toString().trim() =="adminpassword"){
                //开柜
                onConfirmListener?.onConfirm(true)
            }else{
                onConfirmListener?.onConfirm(false)
            }
        }
    }


    private var onConfirmListener:OnConfirmListener?=null
    interface OnConfirmListener{
        fun onConfirm(success:Boolean)
    }
    fun setonConfirmListen(onClickListener:OnConfirmListener){
        onConfirmListener = onClickListener
    }
}